package com.global.test.dao.user.impl;

import java.util.List;

import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Repository;

import com.global.domain.User;
import com.global.emc.dao.impl.EMCMyBatisDAOImpl;
import com.global.emc.spring.security.core.userdetails.jdbc.DatabaseUserDetailsDAO;
import com.global.test.dao.user.UserDAO;

/**   
 *  
 * @Description:  [一句话描述该类的功能]   
 * @Author:       [Joly]   
 * @CreateDate:   [2014年1月15日 下午2:11:03]   
 * @UpdateUser:   [Joly]   
 * @UpdateDate:   [2014年1月15日 下午2:11:03]   
 * @UpdateRemark: [说明本次修改内容]  
 * @Version:      [v1.0] 
 *    
 */
@Repository
public class UserDAOImpl extends EMCMyBatisDAOImpl<User,Integer> implements UserDAO, DatabaseUserDetailsDAO {
	
	@Override
	public int insert(User user) {
		return super.insert("com.global.test.dao.user.UserDAO.insert", user);
	}

	@Override
	public int delete(User user) {
		return super.delete("", user);
	}

	@Override
	public int update(User user) {
		return super.update("", user);
	}

	@Override
	public User queryUserByUsername(String username) {
		return super.selectOne("com.global.test.dao.user.UserDAO.queryUserByUsername",username);
	}

	@Override
	public List<User> queryUsers(User user) {
		return super.selectList("", user);
	}

	@Override
	public UserDetails loadUserByUsername(String username) {
		return super.selectOne("com.global.test.dao.user.UserDAO.loadUserByUsername", username);
	}

}
